#include<iostream>
#include<vector>
using namespace std;

int m = 3, n = 3;
int a[] = {1, 2, 3, 0, 0, 0};
int b[] = {2, 5, 6};

int main()
{
    int cur1 = m - 1, cur2 = n - 1, cur = m + n - 1;
        while(cur1 >= 0 && cur2 >= 0)
        {
            if(a[cur1] <= b[cur2]) a[cur--] = b[cur2--];
            else a[cur--] = a[cur1--];
        }
        while(cur2 >= 0) a[cur--] = b[cur2--];

    for(int i = 0; i < m + n; i ++)
        cout << a[i] << " ";
    return 0;
}